TARGET = main
DEBUG_FLAGS= -g -Werror -std=c++11


SRC_NAME = 	$(patsubst %.cpp, %, $(wildcard *.cpp))   \
            $(patsubst %.c, %, $(wildcard *.c))

CC=gcc
CXX=g++

HELPER_ROOT=$(HOME)/dev/helper/src

INC_PATH += ../../gtest  $(HELPER_ROOT)
LIB_PATH += ../../gtest/gtest
STATIC_LIBS += gtest_main pthread

CFLAGS= $(addprefix -I, $(INC_PATH)) $(DEBUG_FLAGS)
LFLAGS= $(DEBUG_FLAGS) $(addprefix -L, $(LIB_PATH))  $(addprefix -l, $(STATIC_LIBS))

OBJS=$(addsuffix .o, $(SRC_NAME))

all:$(TARGET)

$(TARGET):$(OBJS)
	$(CXX) -o $@ $(OBJS) $(LFLAGS) 

%.o:%.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o:%.cpp
	$(CXX) $(CFLAGS) -c $<

clean:
	rm -frv $(TARGET) $(OBJS) *.o 
